//通过 sleep()方法实现倒计时
public class ThreadSleepDemo01 implements Runnable{
    private int num = 10;

    public static void main(String[] args) {
        ThreadSleepDemo01 tsd = new ThreadSleepDemo01();
        new Thread(tsd).start();
    }

    @Override
    public void run() {

        while(true){
            if(num <= 0)
                break;
            System.out.println(num--);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }

        }

    }
}
